/*
 * atm328pMotor.c
 *
 * Created: 23.05.2013 15:44:27
 *  Author: Vadim
 */ 

#include <main.h>





int main(void)
{
    uint16_t time_0,time_1; 

    /* Initialization led on PD7 and PB1. */
	led_init();
	/* Init Uart in interrupt mode on PD1 and PD0. */
	uart_init();
	/* PD3, PD5, PD6. */
    motor_control_init();
	/*  PB0, PD2 */
	gpio_interrupt_init();

    cli();
    led_set(LED_RED);
    led_set(LED_GRN);
    time_0 = 15535;
    while(time_0 > 0)
    {
       time_0--;
    }
    led_clear(LED_RED);
    led_clear(LED_GRN);
    sei();
	motor_position(0);
    
    for(;;)
	{  
       time_0 = 65535;
       while(time_0 > 0)
       {
        time_0--;
        time_1 = 1;
            while(time_1 > 0)
            {
                time_1--;
            }
       }
       uart_tx(position);	
       uart_tx(mot_A);
       uart_tx(mot_B);
       uart_tx(mot_C);
   }


}
